package com.yp.web;

import com.yp.domain.entity.User;
import com.yp.domain.repository.UserRepository;
import com.yp.domain.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

/**
 * Created by CrazyMouse on 2016/12/29.
 */
@RestController
@RequestMapping("/users")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
    public Object show(@PathVariable int id) {
        User user = userService.findById(id);
        return user;
    }
}
